<?php
class Oslava {

  var $datum;
  var $jmeno;
  var $co;
  var $zbyvaDni;

  function __construct($_datum, $_jmeno, $_co, $_zbyvaDni){
    $this->datum = $_datum;
    $this->jmeno = $_jmeno;
    $this->co = $_co;
    $this->zbyvaDni = $_zbyvaDni;
  }
  
}

class Oslavy {
  
  var $oslavy = array();
  var $pocet;
  
  function Oslavy() {
    $this->pocet = 0;
  }
  
  function pridat($_datum, $_jmeno, $_co, $_zbyvaDni){
    $oslava = new Oslava($_datum, $_jmeno, $_co, $_zbyvaDni);
    $n = 0;
    for(; $n < $this->pocet; $n++) {
      if($this->oslavy[$n]->zbyvaDni > $_zbyvaDni) break;
    }

    for($i = $this->pocet; $i > $n ; $i--) {
      $this->oslavy[$i] = $this->oslavy[$i - 1];
    }
    
    $this->oslavy[$n] = $oslava;
    $this->pocet ++;
  }
  
  function getOslava($idx){
    return $this->oslavy[$idx];
  }
  
  function getPocet() {
    return $this->pocet;
  }
  
}
?>
